package lesson5;

public class WrongResult {

    static volatile int num = 0;

    public static void main(String[] args) throws InterruptedException {
        Runnable runnable = () -> {
            for(int i = 0; i < 10000; i ++){
                num++;
            }
        };

        Thread thread1 = new Thread(runnable);
        thread1.start();

        Thread thread2 = new Thread(runnable);
        thread2.start();

        thread1.join();
        thread2.join();

        System.out.println(num);
    }


}
